#define USART_BAUDRATE 9600
#define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16UL))) - 1)

void Serial_Init(void)
{
    UCSRB |= (1 << RXEN) | (1 << TXEN); // Turn on the transmission and reception circuitry
    UCSRC |= (1 << URSEL) | (1 << UCSZ0) | (1 << UCSZ1); // Use 8-bit character sizes
    UBRRL = BAUD_PRESCALE; // Load lower 8-bits of the baud rate value into the low byte of the UBRR register
    UBRRH = (BAUD_PRESCALE >> 8); // Load upper 8-bits of the baud rate value into the high byte of the UBRR register
}

void Putc(unsigned char c)
{
    while (!(UCSRA & (1<<UDRE))){}
    UDR = c;                      /* sende Zeichen */
}

void Puts (char *s)
{
    while (*s)// while current pointer isn't pointing to '/0' wich is the 'String-end-sign'
    {
        Putc(*s);
        s++;
    }
}

unsigned char Receivec( void )
{
    /* Wait for data to be received */
    while ( !(UCSRA & (1<<RXC)) )
        ;
    /* Get and return received data from buffer */
    return UDR;
}
